package com.jf.spring.component;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-10-23
 * Time:0:37
 */
@Service
public class AdminService {
    /*
    @Autowired注释后, Spring会自动在IOC容器中匹配bean并装配
        先使用byType方式注入
        再使用byName方式注入
        若都匹配失败,则抛出异常
    @Autowired可以和@Qualifier配合使用
        @Qualifier(value = "name/id")指定装配按byName方式注入, 并指定注入的id
     */
    @Autowired
    @Qualifier(value = "adminDAO")
    private AdminDAO adminDAO;

    public AdminDAO getAdminDAO() {
        return adminDAO;
    }
}
